home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-MIPS / POSIX_TY.{2E < prev    next >
Text File  |  1999-09-17  |  3KB  |  121 lines

  1. /* $Id: posix_types.h,v 1.5 1998/08/17 13:59:34 ralf Exp $
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
  8.  */
  9. #ifndef __ARCH_MIPS_POSIX_TYPES_H
  10. #define __ARCH_MIPS_POSIX_TYPES_H
  11.  
  12. #define __need_size_t
  13. #define __need_ptrdiff_t
  14. #include <stddef.h>
  15.  
  16. /*
  17.  * This file is generally used by user-level software, so you need to
  18.  * be a little careful about namespace pollution etc.  Also, we cannot
  19.  * assume GCC is being used.
  20.  */
  21.  
  22. typedef unsigned long    __kernel_dev_t;
  23. typedef unsigned long    __kernel_ino_t;
  24. typedef unsigned long    __kernel_mode_t;
  25. typedef unsigned long    __kernel_nlink_t;
  26. typedef long        __kernel_off_t;
  27. typedef long        __kernel_pid_t;
  28. typedef long        __kernel_ipc_pid_t;
  29. typedef long        __kernel_uid_t;
  30. typedef long        __kernel_gid_t;
  31. typedef __SIZE_TYPE__    __kernel_size_t;
  32. typedef __SSIZE_TYPE__    __kernel_ssize_t;
  33. typedef int        __kernel_ptrdiff_t;
  34. typedef long        __kernel_time_t;
  35. typedef long        __kernel_suseconds_t;
  36. typedef long        __kernel_clock_t;
  37. typedef long        __kernel_daddr_t;
  38. typedef char *        __kernel_caddr_t;
  39.  
  40. #ifdef __GNUC__
  41. typedef long long      __kernel_loff_t;
  42. #endif
  43.  
  44. typedef struct {
  45.         long    val[2];
  46. } __kernel_fsid_t;
  47.  
  48. #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
  49.  
  50. #undef __FD_SET
  51. static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
  52. {
  53.     unsigned long __tmp = __fd / __NFDBITS;
  54.     unsigned long __rem = __fd % __NFDBITS;
  55.     __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
  56. }
  57.  
  58. #undef __FD_CLR
  59. static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
  60. {
  61.     unsigned long __tmp = __fd / __NFDBITS;
  62.     unsigned long __rem = __fd % __NFDBITS;
  63.     __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
  64. }
  65.  
  66. #undef __FD_ISSET
  67. static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
  68.     unsigned long __tmp = __fd / __NFDBITS;
  69.     unsigned long __rem = __fd % __NFDBITS;
  70.     return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
  71. }
  72.  
  73. /*
  74.  * This will unroll the loop for the normal constant case (8 ints,
  75.  * for a 256-bit fd_set)
  76.  */
  77. #undef __FD_ZERO
  78. static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
  79. {
  80.     unsigned long *__tmp = __p->fds_bits;
  81.     int __i;
  82.  
  83.     if (__builtin_constant_p(__FDSET_LONGS)) {
  84.         switch (__FDSET_LONGS) {
  85.         case 16:
  86.             __tmp[ 0] = 0; __tmp[ 1] = 0;
  87.             __tmp[ 2] = 0; __tmp[ 3] = 0;
  88.             __tmp[ 4] = 0; __tmp[ 5] = 0;
  89.             __tmp[ 6] = 0; __tmp[ 7] = 0;
  90.             __tmp[ 8] = 0; __tmp[ 9] = 0;
  91.             __tmp[10] = 0; __tmp[11] = 0;
  92.             __tmp[12] = 0; __tmp[13] = 0;
  93.             __tmp[14] = 0; __tmp[15] = 0;
  94.             return;
  95.  
  96.         case 8:
  97.             __tmp[ 0] = 0; __tmp[ 1] = 0;
  98.             __tmp[ 2] = 0; __tmp[ 3] = 0;
  99.             __tmp[ 4] = 0; __tmp[ 5] = 0;
  100.             __tmp[ 6] = 0; __tmp[ 7] = 0;
  101.             return;
  102.  
  103.         case 4:
  104.             __tmp[ 0] = 0; __tmp[ 1] = 0;
  105.             __tmp[ 2] = 0; __tmp[ 3] = 0;
  106.             return;
  107.         }
  108.     }
  109.     __i = __FDSET_LONGS;
  110.     while (__i) {
  111.         __i--;
  112.         *__tmp = 0;
  113.         __tmp++;
  114.     }
  115. }
  116.  
  117. #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
  118.  
  119. #endif /* __ARCH_MIPS_POSIX_TYPES_H */
  120.